<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>

    </style>
  </head>
  <body>
    <script src="../d3.js"></script>
    <script>
      const data = [
        {province:'黑龙江',cities:['哈尔滨','齐齐哈尔','牡丹江','佳木斯']},
        {province:'吉林',cities:['长春','吉林','松原','延边']},
        {province:'辽宁',cities:['沈阳','大连','鞍山','铁岭']},
      ]

      // const selection = d3.select('body')
      //   .selectAll('dl')
      //   .data(data)
      //   .join('dl')

      // selection.append('dt')
      //   .text(d=>d.province)  

      // selection.selectAll('dd')
      //   .data(d=>d.cities)
      //   .join('dd')
      //   .text(d=>d)

      const selection = d3.select('body')
        .selectAll('dl')
        .data(data)
        .join('dl')
        .call(dl=>{
          dl.append('dt')
            .text(d=>d.province)
        })
        .call(dl=>{
          dl.selectAll('dd')
            .data(d=>d.cities)
            .join('dd')
            .text(d=>d)
        })
    </script> 
  </body>
</html>
